LIBEVENT_DIR	=	~/libevent
CFLAGS			=	-O2 -Wall -I ../include/ -I $(LIBEVENT_DIR)
LIBS			=	$(LIBEVENT_DIR)/.libs/libevent.a
QUIET			=	@

SNAME			:= 	$(shell uname)
LIBS 			= 	$(LIBEVENT_DIR)/.libs/libevent.a
ifeq ($(strip $(SNAME)),Linux)
EXTRALIB 		= 	-lrt
endif


SRC		:= $(shell find . -name "[a-zA-Z]*.c" -print0 | xargs -0)
OBJECTS		= $(subst .c,.o,$(SRC))

.PHONY: clean
	
all: $(MODULE)

%.o: %.c
	@echo "> $@ <"
	$(QUIET) gcc -c $(CFLAGS) $^
	
$(MODULE): $(OBJECTS)
	@echo "+ $@ +"
	$(QUIET) gcc -o $@ $(CFLAGS) $^ $(LIBS) $(EXTRALIB)
	
clean:
	@echo "Cleaning $(MODULE)"
	$(QUIET) rm -rf $(OBJECTS) $(MODULE)